<template>
  <div class="container">
    <top-nav :toLastPath="true">我要招人</top-nav>
    <ul class="nav nav1">
      <li @click="qie('end')"><span :class="{select:type=='end'}">我发布的招聘</span></li>
      <li @click="qie('ing')"><span :class="{select:type=='ing'}">招聘中</span></li>
    </ul>
    <div class="tip" v-if="workList1==''?true :false">不好意思！您没发布过招聘职位点击“我要招人”去招人吧！</div>
    <div class="add" @click="add">
      +我要招人
    </div>


    <workList :workList='workList1' :type="type1" :tag="type" @del="del" v-if="workList1!=''?true :false"></workList>
    <footer-nav :select1="3"></footer-nav>
  </div>
</template>

<script>
import topNav from '@/components/topNav'
import workList from '@/components/workList'
import footerNav from '@/components/footerNav'
export default {
  name:'people',
  data () {
    return {
      type:'end',
      workList1:"",
      type1:"people"
    }
  },

  components: {
     workList,
     topNav,
     footerNav
  },

  methods: {
    qie(value){
      this.type=value
      let status=this.type=='end' ?"":1;
      this.getWorkList(status)
    },
    async add(){
      let userToken=window.localStorage.getItem('userToken')
      let personal=await this.$axios('/cert/judCertDeta',{params:{user_token:userToken}});
      let data=personal.data.data
      if(data.personal_auth==1 ||data.company_auth==1){
        this.$router.push('/people/details')
        return
      }
      this.$currency.showToast('未认证完成',1500,'fail')
      setTimeout(()=>{
        this.$router.push('/me/authentication')

      },2000)
    },
    async getWorkList(status){
      let userToken=window.localStorage.getItem('userToken');

      let res=await this.$axios('/position/getPositionList',{params:{user_token:userToken,status:status,type:"me"}});
      this.workList1=res.data.data;

      if(typeof(res.data.data)!='string'){
        for(let [index,value] of this.workList1.entries()){
        value.sex=this.$currency.sexTag1(value.sex);
      }
      }

    },
    del(status){
      this.getWorkList(status)
    }
  },
  activated(){
    this.getWorkList("")
  }
}
</script>

<style scoped>
.nav{width: 100%;height: 45px;display: flex;justify-content: row;}
.nav1{margin-top:55px;}
.nav li{width: 50%;text-align: center;font-size:18px;color: #000000;
letter-spacing: -0.22px;}
.nav li span{padding-top:10px;padding-top:5px;}
.select{border-bottom: 3px solid #38B4DB;}
.add{width: 200px;height: 44px;line-height: 44px;text-align: center;background-image: linear-gradient(-135deg, #57D1E2 0%, #37AED6 100%);
border-radius: 22px;color: #fff;margin: 20px auto;font-size: 20px;margin-bottom: 65px;}
.tip{width: 238px;height: 51px;font-size: 17px;text-align: center;color: #8E8E93;margin:10px auto;}

  .release_show
  {
    width: 100%;
    padding-top: 15px;
    display: flex;
    box-sizing: border-box;
    position: relative;
  }

  .release_show:after
  {
    content: "";
    width: 100%;
    height: 5px;
    background: rgb(247,247,247);
    position: absolute;
    left: 0;
    bottom: 0;
  }

  .release_left
  {
    width: 74px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
  }

  .header
  {
    width: 50px;
    height: 50px;
    border-radius: 25px;
  }

  .release_right
  {
    width: calc(100% - 74px);
    padding-right: 12px;
    box-sizing: border-box;
  }

  .release_right_top
  {
    width: 100%;
    height: 50px;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .release_right_top_left
  {
    display: flex;
    flex-direction: column;
  }

.release_name
{
  font-size: 16px;
}

.release_time
{
  margin-top: 2px;
  font-size: 12px;
  color: rgb(216,216,216);
}

  .release_contact
  {
    width: 54px;
    height: 26px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 12px;
    color:rgb(148,224,167);
    border: 2px solid rgb(88,208,118);
    background: white;
    border-radius: 5px;
  }

  .release_right_bottom
  {
    width: 100%;
  }

  .release_content
  {
    font-size: 14px;
    padding-top: 10px;
  }

.release_right_bottom_twef
{
  height: 50px;
  display: flex;
  align-items: center;
}

.release_address_img
{
  width: 15px;
  height: 18px;
}

  .release_address
  {
    height: 18px;
    font-size: 12px;
    color:rgb(155,170,205);
    margin-bottom: 2px;
    margin-left: 2px;

  }

</style>
